{extend name='../app/Admin/View/layout.php'/}
{block name='main'}

    <div style="position: absolute;top: 50%; left: 50%;width: 500px;margin-left: -250px;margin-top: -200px">
        <p>
            <el-text class="mx-1" type="warning">
                请提前创建数据库(Mysql),并确保数据库连接配置正确
            </el-text>
        </p>
        <p>
            <el-text class="mx-1" type="warning">
                数据库编码: utf8mb4
            </el-text>
        </p>
        <p>
            <el-text class="mx-1" type="warning">
                数据库版本推荐:  >= 8.0
            </el-text>
        </p>

        <el-button type="primary" @click="init">数据库初始化</el-button>
        <pre v-html="message"></pre>
    </div>

{/block}

{block name='footer'}
    <script>
        VueInit.data.message = "";

        VueInit.methods.init = function ()  {
            axios({
                "url": "",
                "method": "post",
                "data": []
            }).then(({ data }) => {
                if (data.code === 200) {
                    this.$message.success("初始化完成");
                }else{
                    this.$message.error("初始化失败：" + data.msg);
                }
                this.message = data.msg
            }).catch((error) => {
                console.log(error)
            })
        };

    </script>
{/block}